package com.myFwk.constant;

/**
 * @Title:
 * @Description:
 * @Author: guowl
 * @version： 1.0
 * @Date:2021/8/27
 * @Copyright: Copyright(c)2021 RedaFlight.com All Rights Reserved
 */
public class LoginConstant {

    /**
     * 管理员登录
     */
    public static final String ADMIN_TYPE = "admin_type";

    /**
     * 用户/会员登录
     */
    public static final String MEMBER_TYPE = "member_type";

    /**
     * 根据用户名查询
     */
    public static final String QUERY_ADMIN_SQL =
            "SELECT `id` ,`username`, `password`, `status` FROM sys_user WHERE username = ? ";


    /**
     * 查询啊用户角色
     */
    public static final String QUERY_ROLE_CODE_SQL =
            "SELECT `code` FROM sys_role LEFT JOIN sys_user_role ON sys_role.id = sys_user_role.role_id WHERE sys_user_role.user_id= ?";


    /**
     * 查询所有的权限
     */
    public static final String QUERY_ALL_PERMISSIONS =
            "SELECT `name` FROM sys_privilege";


    /**
     * 根据用户角色查询权限
     */
    public static final String QUERY_PERMISSION_SQL =
            "SELECT * FROM sys_privilege LEFT JOIN sys_role_privilege ON sys_role_privilege.privilege_id = sys_privilege.id LEFT JOIN sys_user_role  ON sys_role_privilege.role_id = sys_user_role.role_id WHERE sys_user_role.user_id = ?";

    /**
     * 管理员
     */
    public static final String ADMIN_CODE = "ROLE_ADMIN";

    public static final String MEMBER_CODE = "1";

    public static final String QUERY_MEMBER_SQL = "SELECT `id`,`password`, `status` FROM `sys_user` WHERE mobile = ? or username = ? ";


    public static final String REFRESH_TOKEN = "REFRESH_TOKEN";


    /**
     * 根据用户ID查询
     */
    public static final String QUERY_USER_ID_SQL =
            "SELECT `username` FROM sys_user WHERE id = ? ";

}
